/* GalleryModal 弹窗样式 */
.gallery-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  margin: 0;
  padding: 0;
}

.gallery-modal {
  /* background: #ffffff; */
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 800px;
  height: 600px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 工具栏样式 */
.gallery-modal-toolbar {
  background: #17191d;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.gallery-modal-tool-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* 颜色选择器样式 */
.gallery-modal-color-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
}

.gallery-modal-color-picker label {
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
}

.gallery-modal-color-options {
  display: flex;
  gap: 6px;
}

.gallery-modal-color-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.gallery-modal-color-btn:hover {
  transform: scale(1.1);
}

.gallery-modal-color-btn.active {
  border-color: #00cae0;
  box-shadow: 0 0 0 2px rgba(0, 202, 224, 0.3);
}

.gallery-modal-color-btn.active::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #000;
  font-size: 12px;
  font-weight: bold;
}

.gallery-modal-color-btn[style*="background-color: rgb(255, 255, 255)"]:not(.active) {
  border-color: #ccc;
}

.gallery-modal-color-btn[style*="background-color: rgb(255, 255, 255)"].active::after {
  color: #000;
}

.gallery-modal-color-btn[style*="background-color: rgb(0, 0, 0)"].active::after {
  color: #fff;
}

/* 颜色下拉框样式 */
.gallery-modal-color-dropdown {
  position: relative;
  display: inline-block;
}

.gallery-modal-color-dropdown-trigger {
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #ffffff;
  padding: 6px 12px;
  font-size: 12px;
  min-width: 120px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-modal-color-dropdown-trigger:hover {
  border-color: #666;
  background-color: #333;
}

.gallery-modal-color-dropdown-trigger:focus {
  outline: none;
  border-color: #00cae0;
  box-shadow: 0 0 0 2px rgba(0, 202, 224, 0.2);
}

.gallery-modal-color-preview {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #666;
  flex-shrink: 0;
}

.gallery-modal-color-name {
  flex: 1;
  text-align: left;
}

.gallery-modal-color-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.gallery-modal-color-dropdown-trigger:active .gallery-modal-color-arrow {
  transform: rotate(180deg);
}

.gallery-modal-color-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.gallery-modal-color-dropdown-item {
  width: 100%;
  background: none;
  border: none;
  color: #ffffff;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease;
}

.gallery-modal-color-dropdown-item:hover {
  background-color: #333;
}

.gallery-modal-color-dropdown-item.active {
  background-color: #00cae0;
  color: #000000;
}

.gallery-modal-color-dropdown-item.active .gallery-modal-color-preview {
  border-color: #000000;
}

/* 画笔大小控制器样式 */
.gallery-modal-brush-size {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
}

.gallery-modal-brush-size label {
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
}

.gallery-modal-brush-slider {
  width: 80px;
  height: 4px;
  background: #374151;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.gallery-modal-brush-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: #00cae0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-modal-brush-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.gallery-modal-brush-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #00cae0;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.gallery-modal-brush-size-value {
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  min-width: 30px;
  text-align: center;
}

.gallery-modal-tool-btn {
  background: transparent;
  /* border: 1px solid #d1d5db; */
  color: #374151;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gallery-modal-tool-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #111827;
}

.gallery-modal-tool-btn.gallery-modal-active {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}
/* 
.gallery-modal-tool-btn.gallery-modal-delete-btn {
  color: #dc2626;
  border-color: #fca5a5;
}

.gallery-modal-tool-btn.gallery-modal-delete-btn:hover {
  background: #fef2f2;
  /* border-color: #f87171;
  color: #b91c1c; */
}

.gallery-modal-tool-btn.gallery-modal-save-btn {
  color: #059669;
  border-color: #6ee7b7;
} */

/* .gallery-modal-tool-btn.gallery-modal-save-btn:hover {
  background: #ecfdf5;
  border-color: #34d399;
  color: #047857;
}

.gallery-modal-tool-btn.gallery-modal-download-btn {
  color: #2563eb;
  border-color: #93c5fd;
}

.gallery-modal-tool-btn.gallery-modal-download-btn:hover {
  background: #eff6ff;
  border-color: #60a5fa;
  color: #1d4ed8;
} */

.gallery-modal-close-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.gallery-modal-close-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

/* 画布容器样式 */
.gallery-modal-canvas-container {
  flex: 1;
  position: relative;
  background: #f8f9fa;
  overflow: hidden;
}

.gallery-modal-canvas-area {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* FabricCanvas 容器样式 */
.fabric-canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.fabric-canvas-container canvas {
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* 上传覆盖层样式 */
.gallery-modal-upload-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.gallery-modal-upload-spinner {
  text-align: center;
  color: #666;
}

.gallery-modal-upload-loading-indicator {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: gallery-modal-spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes gallery-modal-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.gallery-modal-upload-spinner p {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .gallery-modal {
    width: 95vw;
    height: 80vh;
    border-radius: 8px;
    max-width: none;
    max-height: none;
  }
  
  .gallery-modal-toolbar {
    padding: 12px 16px;
    min-height: 50px;
  }
  
  .gallery-modal-tool-buttons {
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .gallery-modal-tool-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .gallery-modal {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  
  .gallery-modal-tool-buttons {
    justify-content: center;
    gap: 6px;
  }
  
  .gallery-modal-tool-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* 拖拽区域样式 */
.gallery-modal-canvas-area.drag-over {
  background: rgba(102, 126, 234, 0.1);
  border: 2px dashed #667eea;
}

/* 动画效果 */
.gallery-modal {
  animation: gallery-modal-slide-in 0.3s ease-out;
}

@keyframes gallery-modal-slide-in {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 滚动条样式 */
.gallery-modal-canvas-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.gallery-modal-canvas-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.gallery-modal-canvas-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.gallery-modal-canvas-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
